package gui;

import javax.swing.JPanel;
import java.awt.Dimension;
import javax.swing.JLabel;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import main.Controller;

import javax.swing.JTextArea;
import javax.swing.JComboBox;

/**
 * 
 * @author Christian
 * @since 0.15d
 * 
 * 
 */
public class AddZauberVariante extends JPanel {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * 
	 */
	private JLabel jLabel = null;
	
	/**
	 * 
	 */
	private JPanel jPanel = null;
	
	/**
	 * 
	 */
	private JButton jZurueckButton = null;
	
	/**
	 * 
	 */
	private JButton jSpeichernButton = null;
	
	/**
	 * 
	 */
	private AddZauberVarianteController addController = new AddZauberVarianteController(this);
	
	/**
	 * 
	 */
	private JTextArea jVariantenNameTextArea = null;
	
	/**
	 * 
	 */
	private JLabel jLabel1 = null;
	
	/**
	 * 
	 */
	private JTextArea jKostenTextArea = null;
	
	/**
	 * 
	 */
	private JTextArea jWirkungsDauerTextArea = null;
	
	/**
	 * 
	 */
	private JTextArea jZauberDauerTextArea = null;
	
	/**
	 * 
	 */
	private JTextArea jAnmerkungTextArea = null;
	
	/**
	 * 
	 */
	private JLabel jLabel2 = null;
	
	/**
	 * 
	 */
	private JLabel jLabel3 = null;
	
	/**
	 * 
	 */
	private JLabel jLabel4 = null;
	
	/**
	 * 
	 */
	private JLabel jLabel5 = null;
	
	/**
	 * 
	 */
	private JLabel jLabel6 = null;
	
	/**
	 * 
	 */
	private JLabel jLabel7 = null;
	
	/**
	 * 
	 */
	private JComboBox jZauberNameComboBox = null;
	
	/**
	 * 
	 */
	private JComboBox jRepComboBox = null;
	
	/**
	 * 
	 */
	private JTextArea jKommentarTextArea = null;
	
	/**
	 * 
	 */
	private JLabel jLabel8 = null;
	
	/**
	 * 
	 */
	private JTextArea jReichweiteTextArea = null;
	
	/**
	 * 
	 */
	private JLabel jLabel9 = null;
	
	/**
	 * This method initializes
	 * 
	 */
	public AddZauberVariante() {

		super();
		initialize();
	}
	
	/**
	 * This method initializes this
	 * 
	 */
	private void initialize() {
		this.setSize(new Dimension(470, 403));
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[]{78, 367, 0};
		gridBagLayout.rowHeights = new int[]{38, 40, 18, 18, 13, 13, 13, 13, 13, 13, 13, 93, 0};
		gridBagLayout.columnWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
		gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		setLayout(gridBagLayout);
		jLabel = new JLabel();
		jLabel.setText("Zaubervariante Hinzufügen");
		GridBagConstraints gbc_jLabel = new GridBagConstraints();
		gbc_jLabel.insets = new Insets(0, 0, 5, 0);
		gbc_jLabel.gridx = 1;
		gbc_jLabel.gridy = 1;
		this.add(jLabel, gbc_jLabel);
		jLabel2 = new JLabel();
		jLabel2.setText("Zaubername:");
		GridBagConstraints gbc_jLabel2 = new GridBagConstraints();
		gbc_jLabel2.insets = new Insets(0, 0, 5, 5);
		gbc_jLabel2.gridx = 0;
		gbc_jLabel2.gridy = 2;
		this.add(jLabel2, gbc_jLabel2);
		GridBagConstraints gbc_jZauberNameComboBox = new GridBagConstraints();
		gbc_jZauberNameComboBox.fill = GridBagConstraints.VERTICAL;
		gbc_jZauberNameComboBox.insets = new Insets(0, 0, 5, 0);
		gbc_jZauberNameComboBox.gridx = 1;
		gbc_jZauberNameComboBox.gridy = 2;
		this.add(getJZauberNameComboBox(), gbc_jZauberNameComboBox);
		jLabel3 = new JLabel();
		jLabel3.setText("Repräsentation:");
		GridBagConstraints gbc_jLabel3 = new GridBagConstraints();
		gbc_jLabel3.insets = new Insets(0, 0, 5, 5);
		gbc_jLabel3.gridx = 0;
		gbc_jLabel3.gridy = 3;
		this.add(jLabel3, gbc_jLabel3);
		GridBagConstraints gbc_jRepComboBox = new GridBagConstraints();
		gbc_jRepComboBox.fill = GridBagConstraints.VERTICAL;
		gbc_jRepComboBox.insets = new Insets(0, 0, 5, 0);
		gbc_jRepComboBox.gridx = 1;
		gbc_jRepComboBox.gridy = 3;
		this.add(getJRepComboBox(), gbc_jRepComboBox);
		jLabel1 = new JLabel();
		jLabel1.setText("VariantenName:");
		GridBagConstraints gbc_jLabel1 = new GridBagConstraints();
		gbc_jLabel1.insets = new Insets(0, 0, 5, 5);
		gbc_jLabel1.gridx = 0;
		gbc_jLabel1.gridy = 4;
		this.add(jLabel1, gbc_jLabel1);
		GridBagConstraints gbc_jVariantenNameTextArea = new GridBagConstraints();
		gbc_jVariantenNameTextArea.fill = GridBagConstraints.HORIZONTAL;
		gbc_jVariantenNameTextArea.insets = new Insets(0, 0, 5, 0);
		gbc_jVariantenNameTextArea.gridx = 1;
		gbc_jVariantenNameTextArea.gridy = 4;
		this.add(getJVariantenNameTextArea(), gbc_jVariantenNameTextArea);
		jLabel4 = new JLabel();
		jLabel4.setText("Kosten:");
		GridBagConstraints gbc_jLabel4 = new GridBagConstraints();
		gbc_jLabel4.insets = new Insets(0, 0, 5, 5);
		gbc_jLabel4.gridx = 0;
		gbc_jLabel4.gridy = 5;
		this.add(jLabel4, gbc_jLabel4);
		GridBagConstraints gbc_jKostenTextArea = new GridBagConstraints();
		gbc_jKostenTextArea.fill = GridBagConstraints.HORIZONTAL;
		gbc_jKostenTextArea.insets = new Insets(0, 0, 5, 0);
		gbc_jKostenTextArea.gridx = 1;
		gbc_jKostenTextArea.gridy = 5;
		this.add(getJKostenTextArea(), gbc_jKostenTextArea);
		jLabel5 = new JLabel();
		jLabel5.setText("Zauberdauer:");
		GridBagConstraints gbc_jLabel5 = new GridBagConstraints();
		gbc_jLabel5.insets = new Insets(0, 0, 5, 5);
		gbc_jLabel5.gridx = 0;
		gbc_jLabel5.gridy = 6;
		this.add(jLabel5, gbc_jLabel5);
		GridBagConstraints gbc_jZauberDauerTextArea = new GridBagConstraints();
		gbc_jZauberDauerTextArea.fill = GridBagConstraints.HORIZONTAL;
		gbc_jZauberDauerTextArea.insets = new Insets(0, 0, 5, 0);
		gbc_jZauberDauerTextArea.gridx = 1;
		gbc_jZauberDauerTextArea.gridy = 6;
		this.add(getJZauberDauerTextArea(), gbc_jZauberDauerTextArea);
		jLabel6 = new JLabel();
		jLabel6.setText("Wirkungsdauer:");
		GridBagConstraints gbc_jLabel6 = new GridBagConstraints();
		gbc_jLabel6.insets = new Insets(0, 0, 5, 5);
		gbc_jLabel6.gridx = 0;
		gbc_jLabel6.gridy = 7;
		this.add(jLabel6, gbc_jLabel6);
		GridBagConstraints gbc_jWirkungsDauerTextArea = new GridBagConstraints();
		gbc_jWirkungsDauerTextArea.fill = GridBagConstraints.HORIZONTAL;
		gbc_jWirkungsDauerTextArea.insets = new Insets(0, 0, 5, 0);
		gbc_jWirkungsDauerTextArea.gridx = 1;
		gbc_jWirkungsDauerTextArea.gridy = 7;
		this.add(getJWirkungsDauerTextArea(), gbc_jWirkungsDauerTextArea);
		jLabel9 = new JLabel();
		jLabel9.setText("Reichweite:");
		GridBagConstraints gbc_jLabel9 = new GridBagConstraints();
		gbc_jLabel9.insets = new Insets(0, 0, 5, 5);
		gbc_jLabel9.gridx = 0;
		gbc_jLabel9.gridy = 8;
		this.add(jLabel9, gbc_jLabel9);
		GridBagConstraints gbc_jReichweiteTextArea = new GridBagConstraints();
		gbc_jReichweiteTextArea.fill = GridBagConstraints.HORIZONTAL;
		gbc_jReichweiteTextArea.insets = new Insets(0, 0, 5, 0);
		gbc_jReichweiteTextArea.gridx = 1;
		gbc_jReichweiteTextArea.gridy = 8;
		this.add(getJReichweiteTextArea(), gbc_jReichweiteTextArea);
		jLabel7 = new JLabel();
		jLabel7.setText("Anmerkung:");
		GridBagConstraints gbc_jLabel7 = new GridBagConstraints();
		gbc_jLabel7.insets = new Insets(0, 0, 5, 5);
		gbc_jLabel7.gridx = 0;
		gbc_jLabel7.gridy = 9;
		this.add(jLabel7, gbc_jLabel7);
		GridBagConstraints gbc_jAnmerkungTextArea = new GridBagConstraints();
		gbc_jAnmerkungTextArea.fill = GridBagConstraints.HORIZONTAL;
		gbc_jAnmerkungTextArea.insets = new Insets(0, 0, 5, 0);
		gbc_jAnmerkungTextArea.gridx = 1;
		gbc_jAnmerkungTextArea.gridy = 9;
		this.add(getJAnmerkungTextArea(), gbc_jAnmerkungTextArea);
		jLabel8 = new JLabel();
		jLabel8.setText("Kommentar:");
		GridBagConstraints gbc_jLabel8 = new GridBagConstraints();
		gbc_jLabel8.insets = new Insets(0, 0, 5, 5);
		gbc_jLabel8.gridx = 0;
		gbc_jLabel8.gridy = 10;
		this.add(jLabel8, gbc_jLabel8);
		GridBagConstraints gbc_jKommentarTextArea = new GridBagConstraints();
		gbc_jKommentarTextArea.fill = GridBagConstraints.HORIZONTAL;
		gbc_jKommentarTextArea.insets = new Insets(0, 0, 5, 0);
		gbc_jKommentarTextArea.gridx = 1;
		gbc_jKommentarTextArea.gridy = 10;
		this.add(getJKommentarTextArea(), gbc_jKommentarTextArea);
		GridBagConstraints gbc_jPanel = new GridBagConstraints();
		gbc_jPanel.gridx = 1;
		gbc_jPanel.gridy = 11;
		this.add(getJPanel(), gbc_jPanel);
	}
	
	/**
	 * This method initializes jPanel
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPanel() {

		if (jPanel == null) {
			jPanel = new JPanel();
			jPanel.setLayout(new GridBagLayout());
			GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
			gridBagConstraints1.gridx = 0;
			gridBagConstraints1.gridy = 0;
			gridBagConstraints1.insets = new Insets(5, 5, 5, 5);
			jPanel.add(getJZurueckButton(), gridBagConstraints1);
			GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
			gridBagConstraints2.gridx = 1;
			gridBagConstraints2.gridy = 0;
			gridBagConstraints2.insets = new Insets(5, 5, 5, 0);
			jPanel.add(getJSpeichernButton(), gridBagConstraints2);
		}
		return jPanel;
	}
	
	/**
	 * This method initializes jZurueckButton
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getJZurueckButton() {

		if (jZurueckButton == null) {
			jZurueckButton = new JButton();
			jZurueckButton.setText("zurück");
			jZurueckButton.addActionListener(new ActionListener() {
				
				@Override
				public void actionPerformed(ActionEvent e) {

					Controller.getGuiController().zeigeHauptfenster();
				}
			});
		}
		return jZurueckButton;
	}
	
	/**
	 * This method initializes jSpeichernButton
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getJSpeichernButton() {

		if (jSpeichernButton == null) {
			jSpeichernButton = new JButton();
			jSpeichernButton.setText("speichern");
			jSpeichernButton.addActionListener(addController);
		}
		return jSpeichernButton;
	}
	
	/**
	 * This method initializes jVariantenNameTextArea
	 * 
	 * @return javax.swing.JTextArea
	 */
	public JTextArea getJVariantenNameTextArea() {

		if (jVariantenNameTextArea == null) {
			jVariantenNameTextArea = new JTextArea();
			jVariantenNameTextArea.setRows(1);
			jVariantenNameTextArea.setLineWrap(true);
		}
		return jVariantenNameTextArea;
	}
	
	/**
	 * This method initializes jKostenTextArea
	 * 
	 * @return javax.swing.JTextArea
	 */
	public JTextArea getJKostenTextArea() {

		if (jKostenTextArea == null) {
			jKostenTextArea = new JTextArea();
			jKostenTextArea.setLineWrap(true);
		}
		return jKostenTextArea;
	}
	
	/**
	 * This method initializes jWirkungsDauerTextArea
	 * 
	 * @return javax.swing.JTextArea
	 */
	public JTextArea getJWirkungsDauerTextArea() {

		if (jWirkungsDauerTextArea == null) {
			jWirkungsDauerTextArea = new JTextArea();
			jWirkungsDauerTextArea.setLineWrap(true);
		}
		return jWirkungsDauerTextArea;
	}
	
	/**
	 * This method initializes jZauberDauerTextArea
	 * 
	 * @return javax.swing.JTextArea
	 */
	public JTextArea getJZauberDauerTextArea() {

		if (jZauberDauerTextArea == null) {
			jZauberDauerTextArea = new JTextArea();
			jZauberDauerTextArea.setLineWrap(true);
		}
		return jZauberDauerTextArea;
	}
	
	/**
	 * This method initializes jAnmerkungTextArea
	 * 
	 * @return javax.swing.JTextArea
	 */
	public JTextArea getJAnmerkungTextArea() {

		if (jAnmerkungTextArea == null) {
			jAnmerkungTextArea = new JTextArea(2, 30);
			jAnmerkungTextArea.setLineWrap(true);
		}
		return jAnmerkungTextArea;
	}
	
	/**
	 * This method initializes jZauberNameComboBox
	 * 
	 * @return javax.swing.JComboBox
	 */
	public JComboBox getJZauberNameComboBox() {

		if (jZauberNameComboBox == null) {
			jZauberNameComboBox = new JComboBox();
			for (String rep : Controller.getDatenController().getAlleZauberNamen()) {
				jZauberNameComboBox.addItem(rep);
			}
		}
		return jZauberNameComboBox;
	}
	
	/**
	 * This method initializes jRepComboBox
	 * 
	 * @return javax.swing.JComboBox
	 */
	public JComboBox getJRepComboBox() {

		if (jRepComboBox == null) {
			jRepComboBox = new JComboBox();
			for (String rep : Controller.getDatenController().getRepraesentationenList()) {
				jRepComboBox.addItem(rep);
			}
		}
		return jRepComboBox;
	}
	
	/**
	 * This method initializes jKommentarTextArea
	 * 
	 * @return javax.swing.JTextArea
	 */
	public JTextArea getJKommentarTextArea() {

		if (jKommentarTextArea == null) {
			jKommentarTextArea = new JTextArea(2, 30);
			jKommentarTextArea.setLineWrap(true);
		}
		return jKommentarTextArea;
	}
	
	/**
	 * This method initializes jReichweiteTextArea
	 * 
	 * @return javax.swing.JTextArea
	 */
	public JTextArea getJReichweiteTextArea() {

		if (jReichweiteTextArea == null) {
			jReichweiteTextArea = new JTextArea();
			jReichweiteTextArea.setLineWrap(true);
		}
		return jReichweiteTextArea;
	}
} // @jve:decl-index=0:visual-constraint="176,10"
